#ifndef _WX_FRAMEMANAGER_H_
#define _WX_FRAMEMANAGER_H_

#include "wx/defs.h"
#include "wx/dynarray.h"
#include "wx/gdicmn.h"
#include "wx/window.h"
#include "wx/timer.h"
#include "wx/sizer.h"

enum wxAuiManagerDock {
  wxAUI_DOCK_NONE = 0,
  wxAUI_DOCK_TOP = 1,
  wxAUI_DOCK_RIGHT = 2,
  wxAUI_DOCK_BOTTOM = 3,
  wxAUI_DOCK_LEFT = 4,
  wxAUI_DOCK_CENTER = 5,
  wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
};

enum wxAuiManagerOption {
  wxAUI_MGR_ALLOW_FLOATING           = 1 << 0,
  wxAUI_MGR_ALLOW_ACTIVE_PANE        = 1 << 1,
  wxAUI_MGR_TRANSPARENT_DRAG         = 1 << 2,
  wxAUI_MGR_TRANSPARENT_HINT         = 1 << 3,
  wxAUI_MGR_VENETIAN_BLINDS_HINT     = 1 << 4,
  wxAUI_MGR_RECTANGLE_HINT           = 1 << 5,
  wxAUI_MGR_HINT_FADE                = 1 << 6,
  wxAUI_MGR_NO_VENETIAN_BLINDS_FADE  = 1 << 7,
  wxAUI_MGR_LIVE_RESIZE              = 1 << 8,

  wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
                      wxAUI_MGR_TRANSPARENT_HINT |
                      wxAUI_MGR_HINT_FADE |
                      wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
};


enum wxAuiPaneDockArtSetting {
  wxAUI_DOCKART_SASH_SIZE = 0,
  wxAUI_DOCKART_CAPTION_SIZE = 1,
  wxAUI_DOCKART_GRIPPER_SIZE = 2,
  wxAUI_DOCKART_PANE_BORDER_SIZE = 3,
  wxAUI_DOCKART_PANE_BUTTON_SIZE = 4,
  wxAUI_DOCKART_BACKGROUND_COLOUR = 5,
  wxAUI_DOCKART_SASH_COLOUR = 6,
  wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7,
  wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8,
  wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9,
  wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10,
  wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11,
  wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12,
  wxAUI_DOCKART_BORDER_COLOUR = 13,
  wxAUI_DOCKART_GRIPPER_COLOUR = 14,
  wxAUI_DOCKART_CAPTION_FONT = 15,
  wxAUI_DOCKART_GRADIENT_TYPE = 16
};

enum wxAuiPaneDockArtGradients {
  wxAUI_GRADIENT_NONE = 0,
  wxAUI_GRADIENT_VERTICAL = 1,
  wxAUI_GRADIENT_HORIZONTAL = 2
};

enum wxAuiPaneButtonState {
  wxAUI_BUTTON_STATE_NORMAL   = 0,
  wxAUI_BUTTON_STATE_HOVER    = 1 << 1,
  wxAUI_BUTTON_STATE_PRESSED  = 1 << 2,
  wxAUI_BUTTON_STATE_DISABLED = 1 << 3,
  wxAUI_BUTTON_STATE_HIDDEN   = 1 << 4,
  wxAUI_BUTTON_STATE_CHECKED  = 1 << 5
};

enum wxAuiButtonId {
  wxAUI_BUTTON_CLOSE = 101,
  wxAUI_BUTTON_MAXIMIZE_RESTORE = 102,
  wxAUI_BUTTON_MINIMIZE = 103,
  wxAUI_BUTTON_PIN = 104,
  wxAUI_BUTTON_OPTIONS = 105,
  wxAUI_BUTTON_WINDOWLIST = 106,
  wxAUI_BUTTON_LEFT = 107,
  wxAUI_BUTTON_RIGHT = 108,
  wxAUI_BUTTON_UP = 109,
  wxAUI_BUTTON_DOWN = 110,
  wxAUI_BUTTON_CUSTOM1 = 201,
  wxAUI_BUTTON_CUSTOM2 = 202,
  wxAUI_BUTTON_CUSTOM3 = 203
};

enum wxAuiPaneInsertLevel {
  wxAUI_INSERT_PANE = 0,
  wxAUI_INSERT_ROW = 1,
  wxAUI_INSERT_DOCK = 2
};




class wxAuiDockUIPart;
class wxAuiPaneButton;
class wxAuiPaneInfo;
class wxAuiDockInfo;
class wxAuiDockArt;
class wxAuiManagerEvent;

WX_DECLARE_USER_EXPORTED_OBJARRAY( wxAuiDockInfo, wxAuiDockInfoArray );
WX_DECLARE_USER_EXPORTED_OBJARRAY( wxAuiDockUIPart, wxAuiDockUIPartArray );
WX_DECLARE_USER_EXPORTED_OBJARRAY( wxAuiPaneButton, wxAuiPaneButtonArray );
WX_DECLARE_USER_EXPORTED_OBJARRAY( wxAuiPaneInfo, wxAuiPaneInfoArray );
WX_DEFINE_USER_EXPORTED_ARRAY_PTR( wxAuiPaneInfo*, wxAuiPaneInfoPtrArray);
WX_DEFINE_USER_EXPORTED_ARRAY_PTR( wxAuiDockInfo*, wxAuiDockInfoPtrArray);

extern wxAuiDockInfo wxAuiNullDockInfo;
extern wxAuiPaneInfo wxAuiNullPaneInfo;



class wxAuiPaneInfo {
  public:

    wxAuiPaneInfo() {
      window = NULL;
      frame = NULL;
      state = 0;
      dock_direction = wxAUI_DOCK_LEFT;
      dock_layer = 0;
      dock_row = 0;
      dock_pos = 0;
      floating_pos = wxDefaultPosition;
      floating_size = wxDefaultSize;
      best_size = wxDefaultSize;
      min_size = wxDefaultSize;
      max_size = wxDefaultSize;
      dock_proportion = 0;
      DefaultPane();
    }

    ~wxAuiPaneInfo() {}
    wxAuiPaneInfo( const wxAuiPaneInfo& c ) {
      name = c.name;
      caption = c.caption;
      window = c.window;
      frame = c.frame;
      state = c.state;
      dock_direction = c.dock_direction;
      dock_layer = c.dock_layer;
      dock_row = c.dock_row;
      dock_pos = c.dock_pos;
      best_size = c.best_size;
      min_size = c.min_size;
      max_size = c.max_size;
      floating_pos = c.floating_pos;
      floating_size = c.floating_size;
      dock_proportion = c.dock_proportion;
      buttons = c.buttons;
      rect = c.rect;
    }

    wxAuiPaneInfo& operator=( const wxAuiPaneInfo& c ) {
      name = c.name;
      caption = c.caption;
      window = c.window;
      frame = c.frame;
      state = c.state;
      dock_direction = c.dock_direction;
      dock_layer = c.dock_layer;
      dock_row = c.dock_row;
      dock_pos = c.dock_pos;
      best_size = c.best_size;
      min_size = c.min_size;
      max_size = c.max_size;
      floating_pos = c.floating_pos;
      floating_size = c.floating_size;
      dock_proportion = c.dock_proportion;
      buttons = c.buttons;
      rect = c.rect;
      return *this;
    }

    void SafeSet( wxAuiPaneInfo source ) {
            source.window = window;
      source.frame = frame;
      source.buttons = buttons;

      *this = source;
    }

    bool IsOk() const { return ( window != NULL ) ? true : false; }
    bool IsFixed() const { return !HasFlag( optionResizable ); }
    bool IsResizable() const { return HasFlag( optionResizable ); }
    bool IsShown() const { return !HasFlag( optionHidden ); }
    bool IsFloating() const { return HasFlag( optionFloating ); }
    bool IsDocked() const { return !HasFlag( optionFloating ); }
    bool IsToolbar() const { return HasFlag( optionToolbar ); }
    bool IsTopDockable() const { return HasFlag( optionTopDockable ); }
    bool IsBottomDockable() const { return HasFlag( optionBottomDockable ); }
    bool IsLeftDockable() const { return HasFlag( optionLeftDockable ); }
    bool IsRightDockable() const { return HasFlag( optionRightDockable ); }
    bool IsFloatable() const { return HasFlag( optionFloatable ); }
    bool IsMovable() const { return HasFlag( optionMovable ); }
    bool IsDestroyOnClose() const { return HasFlag( optionDestroyOnClose ); }
    bool IsMaximized() const { return HasFlag( optionMaximized ); }
    bool HasCaption() const { return HasFlag( optionCaption ); }
    bool HasGripper() const { return HasFlag( optionGripper ); }
    bool HasBorder() const { return HasFlag( optionPaneBorder ); }
    bool HasCloseButton() const { return HasFlag( buttonClose ); }
    bool HasMaximizeButton() const { return HasFlag( buttonMaximize ); }
    bool HasMinimizeButton() const { return HasFlag( buttonMinimize ); }
    bool HasPinButton() const { return HasFlag( buttonPin ); }
    bool HasGripperTop() const { return HasFlag( optionGripperTop ); }
    wxAuiPaneInfo& Window( wxWindow* w ) { window = w; return *this; }
    wxAuiPaneInfo& Name( const wxString& n ) { name = n; return *this; }
    wxAuiPaneInfo& Caption( const wxString& c ) { caption = c; return *this; }
    wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
    wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
    wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
    wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
    wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
    wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
    wxAuiPaneInfo& Direction( int direction ) { dock_direction = direction; return *this; }
    wxAuiPaneInfo& Layer( int layer ) { dock_layer = layer; return *this; }
    wxAuiPaneInfo& Row( int row ) { dock_row = row; return *this; }
    wxAuiPaneInfo& Position( int pos ) { dock_pos = pos; return *this; }
    wxAuiPaneInfo& BestSize( const wxSize& size ) { best_size = size; return *this; }
    wxAuiPaneInfo& MinSize( const wxSize& size ) { min_size = size; return *this; }
    wxAuiPaneInfo& MaxSize( const wxSize& size ) { max_size = size; return *this; }
    wxAuiPaneInfo& BestSize( int x, int y ) { best_size.Set( x, y ); return *this; }
    wxAuiPaneInfo& MinSize( int x, int y ) { min_size.Set( x, y ); return *this; }
    wxAuiPaneInfo& MaxSize( int x, int y ) { max_size.Set( x, y ); return *this; }
    wxAuiPaneInfo& FloatingPosition( const wxPoint& pos ) { floating_pos = pos; return *this; }
    wxAuiPaneInfo& FloatingPosition( int x, int y ) { floating_pos.x = x; floating_pos.y = y; return *this; }
    wxAuiPaneInfo& FloatingSize( const wxSize& size ) { floating_size = size; return *this; }
    wxAuiPaneInfo& FloatingSize( int x, int y ) { floating_size.Set( x, y ); return *this; }
    wxAuiPaneInfo& Fixed() { return SetFlag( optionResizable, false ); }
    wxAuiPaneInfo& Resizable( bool resizable = true ) { return SetFlag( optionResizable, resizable ); }
    wxAuiPaneInfo& Dock() { return SetFlag( optionFloating, false ); }
    wxAuiPaneInfo& Float() { return SetFlag( optionFloating, true ); }
    wxAuiPaneInfo& Hide() { return SetFlag( optionHidden, true ); }
    wxAuiPaneInfo& Show( bool show = true ) { return SetFlag( optionHidden, !show ); }
    wxAuiPaneInfo& CaptionVisible( bool visible = true ) { return SetFlag( optionCaption, visible ); }
    wxAuiPaneInfo& Maximize() { return SetFlag( optionMaximized, true ); }
    wxAuiPaneInfo& Restore() { return SetFlag( optionMaximized, false ); }
    wxAuiPaneInfo& PaneBorder( bool visible = true ) { return SetFlag( optionPaneBorder, visible ); }
    wxAuiPaneInfo& Gripper( bool visible = true ) { return SetFlag( optionGripper, visible ); }
    wxAuiPaneInfo& GripperTop( bool attop = true ) { return SetFlag( optionGripperTop, attop ); }
    wxAuiPaneInfo& CloseButton( bool visible = true ) { return SetFlag( buttonClose, visible ); }
    wxAuiPaneInfo& MaximizeButton( bool visible = true ) { return SetFlag( buttonMaximize, visible ); }
    wxAuiPaneInfo& MinimizeButton( bool visible = true ) { return SetFlag( buttonMinimize, visible ); }
    wxAuiPaneInfo& PinButton( bool visible = true ) { return SetFlag( buttonPin, visible ); }
    wxAuiPaneInfo& DestroyOnClose( bool b = true ) { return SetFlag( optionDestroyOnClose, b ); }
    wxAuiPaneInfo& TopDockable( bool b = true ) { return SetFlag( optionTopDockable, b ); }
    wxAuiPaneInfo& BottomDockable( bool b = true ) { return SetFlag( optionBottomDockable, b ); }
    wxAuiPaneInfo& LeftDockable( bool b = true ) { return SetFlag( optionLeftDockable, b ); }
    wxAuiPaneInfo& RightDockable( bool b = true ) { return SetFlag( optionRightDockable, b ); }
    wxAuiPaneInfo& Floatable( bool b = true ) { return SetFlag( optionFloatable, b ); }
    wxAuiPaneInfo& Movable( bool b = true ) { return SetFlag( optionMovable, b ); }
    wxAuiPaneInfo& DockFixed( bool b = true ) { return SetFlag( optionDockFixed, b ); }
    wxAuiPaneInfo& Dockable( bool b = true ) {
      return TopDockable( b ).BottomDockable( b ).LeftDockable( b ).RightDockable( b );
    }

    wxAuiPaneInfo& DefaultPane() {
      state |= optionTopDockable | optionBottomDockable |
               optionLeftDockable | optionRightDockable |
               optionFloatable | optionMovable | optionResizable |
               optionCaption | optionPaneBorder | buttonClose;
      return *this;
    }

    wxAuiPaneInfo& CentrePane() { return CenterPane(); }
    wxAuiPaneInfo& CenterPane() {
      state = 0;
      return Center().PaneBorder().Resizable();
    }

    wxAuiPaneInfo& ToolbarPane() {
      DefaultPane();
      state |= ( optionToolbar | optionGripper );
      state &= ~( optionResizable | optionCaption );
      if( dock_layer == 0 ) {
        dock_layer = 10;
      }
      return *this;
    }

    wxAuiPaneInfo& SetFlag( unsigned int flag, bool option_state ) {
      if( option_state ) {
        state |= flag;
      } else
      { state &= ~flag; }
      return *this;
    }

    bool HasFlag( unsigned int flag ) const {
      return ( state & flag ) ? true : false;
    }

  public:
    enum wxAuiPaneState {
      optionFloating        = 1 << 0,
      optionHidden          = 1 << 1,
      optionLeftDockable    = 1 << 2,
      optionRightDockable   = 1 << 3,
      optionTopDockable     = 1 << 4,
      optionBottomDockable  = 1 << 5,
      optionFloatable       = 1 << 6,
      optionMovable         = 1 << 7,
      optionResizable       = 1 << 8,
      optionPaneBorder      = 1 << 9,
      optionCaption         = 1 << 10,
      optionGripper         = 1 << 11,
      optionDestroyOnClose  = 1 << 12,
      optionToolbar         = 1 << 13,
      optionActive          = 1 << 14,
      optionGripperTop      = 1 << 15,
      optionMaximized       = 1 << 16,
      optionDockFixed       = 1 << 17,

      buttonClose           = 1 << 21,
      buttonMaximize        = 1 << 22,
      buttonMinimize        = 1 << 23,
      buttonPin             = 1 << 24,

      buttonCustom1         = 1 << 26,
      buttonCustom2         = 1 << 27,
      buttonCustom3         = 1 << 28,

      savedHiddenState      = 1 << 30,
      actionPane            = 1 << 31
    };

  public:
    wxString name;
    wxString caption;

    wxWindow* window;
    wxFrame* frame;
    unsigned int state;

    int dock_direction;
    int dock_layer;
    int dock_row;
    int dock_pos;

    wxSize best_size;
    wxSize min_size;
    wxSize max_size;

    wxPoint floating_pos;
    wxSize floating_size;
    int dock_proportion;

    wxAuiPaneButtonArray buttons;

    wxRect rect;
};

class wxAuiFloatingFrame;

class wxAuiManager : public wxEvtHandler {
    friend class wxAuiFloatingFrame;
  public:
    wxAuiManager( wxWindow* managed_wnd = NULL, unsigned int flags = wxAUI_MGR_DEFAULT );
    virtual ~wxAuiManager();
    void UnInit();
    void SetFlags( unsigned int flags );
    unsigned int GetFlags() const;
    void SetManagedWindow( wxWindow* managed_wnd );
    wxWindow* GetManagedWindow() const;
    static wxAuiManager* GetManager( wxWindow* window );
    void SetArtProvider( wxAuiDockArt* art_provider );
    wxAuiDockArt* GetArtProvider() const;
    wxAuiPaneInfo& GetPane( wxWindow* window );
    wxAuiPaneInfo& GetPane( const wxString& name );
    wxAuiPaneInfoArray& GetAllPanes();
    bool AddPane( wxWindow* window, const wxAuiPaneInfo& pane_info );
    bool AddPane( wxWindow* window, const wxAuiPaneInfo& pane_info, const wxPoint& drop_pos );
    bool AddPane( wxWindow* window, int direction = wxLEFT, const wxString& caption = wxEmptyString );
    bool InsertPane( wxWindow* window, const wxAuiPaneInfo& insert_location, int insert_level = wxAUI_INSERT_PANE );
    bool DetachPane( wxWindow* window );
    void Update();
    wxString SavePaneInfo( wxAuiPaneInfo& pane );
    void LoadPaneInfo( wxString pane_part, wxAuiPaneInfo &pane );
    wxString SavePerspective();
    bool LoadPerspective( const wxString& perspective, bool update = true );
    void SetDockSizeConstraint( double width_pct, double height_pct );
    void GetDockSizeConstraint( double* width_pct, double* height_pct ) const;
    void ClosePane( wxAuiPaneInfo& pane_info );
    void MaximizePane( wxAuiPaneInfo& pane_info );
    void RestorePane( wxAuiPaneInfo& pane_info );
    void RestoreMaximizedPane();
  public:
    virtual wxAuiFloatingFrame* CreateFloatingFrame( wxWindow* parent, const wxAuiPaneInfo& p );
    void StartPaneDrag( wxWindow* pane_window, const wxPoint& offset );
    wxRect CalculateHintRect( wxWindow* pane_window, const wxPoint& pt, const wxPoint& offset );
    void DrawHintRect( wxWindow* pane_window, const wxPoint& pt, const wxPoint& offset );
    virtual void ShowHint( const wxRect& rect );
    virtual void HideHint();
  public:
    wxDEPRECATED( void SetFrame( wxFrame* frame ) );
    wxDEPRECATED( wxFrame* GetFrame() const );
  protected:
    void UpdateHintWindowConfig();
    void DoFrameLayout();
    void LayoutAddPane( wxSizer* container, wxAuiDockInfo& dock, wxAuiPaneInfo& pane, wxAuiDockUIPartArray& uiparts, bool spacer_only );
    void LayoutAddDock( wxSizer* container, wxAuiDockInfo& dock, wxAuiDockUIPartArray& uiparts, bool spacer_only );
    wxSizer* LayoutAll( wxAuiPaneInfoArray& panes, wxAuiDockInfoArray& docks, wxAuiDockUIPartArray& uiparts, bool spacer_only = false );
    virtual bool ProcessDockResult( wxAuiPaneInfo& target, const wxAuiPaneInfo& new_pos );
    bool DoDrop( wxAuiDockInfoArray& docks, wxAuiPaneInfoArray& panes, wxAuiPaneInfo& drop,
                 const wxPoint& pt, const wxPoint& action_offset = wxPoint( 0, 0 ) );
    wxAuiDockUIPart* HitTest( int x, int y );
    wxAuiDockUIPart* GetPanePart( wxWindow* pane );
    int GetDockPixelOffset( wxAuiPaneInfo& test );
    void OnFloatingPaneMoveStart( wxWindow* window );
    void OnFloatingPaneMoving( wxWindow* window, wxDirection dir );
    void OnFloatingPaneMoved( wxWindow* window, wxDirection dir );
    void OnFloatingPaneActivated( wxWindow* window );
    void OnFloatingPaneClosed( wxWindow* window, wxCloseEvent& evt );
    void OnFloatingPaneResized( wxWindow* window, const wxSize& size );
    void Render( wxDC* dc );
    void Repaint( wxDC* dc = NULL );
    void ProcessMgrEvent( wxAuiManagerEvent& event );
    void UpdateButtonOnScreen( wxAuiDockUIPart* button_ui_part, const wxMouseEvent& event );
    void GetPanePositionsAndSizes( wxAuiDockInfo& dock, wxArrayInt& positions, wxArrayInt& sizes );
    bool DoEndResizeAction( wxMouseEvent& event );
  public:
    void OnRender( wxAuiManagerEvent& evt );
    void OnPaneButton( wxAuiManagerEvent& evt );
  protected:
    void OnPaint( wxPaintEvent& evt );
    void OnEraseBackground( wxEraseEvent& evt );
    void OnSize( wxSizeEvent& evt );
    void OnSetCursor( wxSetCursorEvent& evt );
    void OnLeftDown( wxMouseEvent& evt );
    void OnLeftUp( wxMouseEvent& evt );
    void OnMotion( wxMouseEvent& evt );
    void OnLeaveWindow( wxMouseEvent& evt );
    void OnChildFocus( wxChildFocusEvent& evt );
    void OnHintFadeTimer( wxTimerEvent& evt );
    void OnFindManager( wxAuiManagerEvent& evt );
  protected:
    enum {
      actionNone = 0,
      actionResize,
      actionClickButton,
      actionClickCaption,
      actionDragToolbarPane,
      actionDragFloatingPane
    };
  protected:
    wxWindow* m_frame;
    wxAuiDockArt* m_art;
    unsigned int m_flags;
    wxAuiPaneInfoArray m_panes;
    wxAuiDockInfoArray m_docks;
    wxAuiDockUIPartArray m_uiparts;
    int m_action;
    wxPoint m_action_start;
    wxPoint m_action_offset;
    wxAuiDockUIPart* m_action_part;
    wxWindow* m_action_window;
    wxRect m_action_hintrect;
    wxRect m_last_rect;
    wxAuiDockUIPart* m_hover_button;
    wxRect m_last_hint;
    wxPoint m_last_mouse_move;
    bool m_skipping;
    bool m_has_maximized;
    double m_dock_constraint_x;
    double m_dock_constraint_y;
    wxFrame* m_hint_wnd;
    wxTimer m_hint_fadetimer;
    wxByte m_hint_fadeamt;
    wxByte m_hint_fademax;
    void* m_reserved;
    DECLARE_EVENT_TABLE()
    DECLARE_CLASS( wxAuiManager )
};

class wxAuiManagerEvent : public wxEvent {
  public:
    wxAuiManagerEvent( wxEventType type = wxEVT_NULL ) : wxEvent( 0, type ) {
      manager = NULL;
      pane = NULL;
      button = 0;
      veto_flag = false;
      canveto_flag = true;
      dc = NULL;
    }
    wxAuiManagerEvent( const wxAuiManagerEvent& c ) : wxEvent( c ) {
      manager = c.manager;
      pane = c.pane;
      button = c.button;
      veto_flag = c.veto_flag;
      canveto_flag = c.canveto_flag;
      dc = c.dc;
    }
    wxEvent *Clone() const { return new wxAuiManagerEvent( *this ); }

    void SetManager( wxAuiManager* mgr ) { manager = mgr; }
    void SetPane( wxAuiPaneInfo* p ) { pane = p; }
    void SetButton( int b ) { button = b; }
    void SetDC( wxDC* pdc ) { dc = pdc; }

    wxAuiManager* GetManager() const { return manager; }
    wxAuiPaneInfo* GetPane() const { return pane; }
    int GetButton() const { return button; }
    wxDC* GetDC() const { return dc; }

    void Veto( bool veto = true ) { veto_flag = veto; }
    bool GetVeto() const { return veto_flag; }
    void SetCanVeto( bool can_veto ) { canveto_flag = can_veto; }
    bool CanVeto() const { return  canveto_flag && veto_flag; }

  public:
    wxAuiManager* manager;
    wxAuiPaneInfo* pane;
    int button;
    bool veto_flag;
    bool canveto_flag;
    wxDC* dc;
  private:
    DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxAuiManagerEvent )
};


class wxAuiDockInfo {
  public:
    wxAuiDockInfo() {
      dock_direction = 0;
      dock_layer = 0;
      dock_row = 0;
      size = 0;
      min_size = 0;
      resizable = true;
      fixed = false;
      toolbar = false;
      reserved1 = false;
    }
    wxAuiDockInfo( const wxAuiDockInfo& c ) {
      dock_direction = c.dock_direction;
      dock_layer = c.dock_layer;
      dock_row = c.dock_row;
      size = c.size;
      min_size = c.min_size;
      resizable = c.resizable;
      fixed = c.fixed;
      toolbar = c.toolbar;
      panes = c.panes;
      rect = c.rect;
      reserved1 = c.reserved1;
    }

    wxAuiDockInfo& operator=( const wxAuiDockInfo& c ) {
      dock_direction = c.dock_direction;
      dock_layer = c.dock_layer;
      dock_row = c.dock_row;
      size = c.size;
      min_size = c.min_size;
      resizable = c.resizable;
      fixed = c.fixed;
      toolbar = c.toolbar;
      panes = c.panes;
      rect = c.rect;
      reserved1 = c.reserved1;
      return *this;
    }
    bool IsOk() const { return ( dock_direction != 0 ) ? true : false; }
    bool IsHorizontal() const {
      return ( dock_direction == wxAUI_DOCK_TOP ||
               dock_direction == wxAUI_DOCK_BOTTOM ) ? true : false;
    }
    bool IsVertical() const {
      return ( dock_direction == wxAUI_DOCK_LEFT ||
               dock_direction == wxAUI_DOCK_RIGHT ||
               dock_direction == wxAUI_DOCK_CENTER ) ? true : false;
    }
  public:
    wxAuiPaneInfoPtrArray panes;
    wxRect rect;
    int dock_direction;
    int dock_layer;
    int dock_row;
    int size;
    int min_size;
    bool resizable;
    bool toolbar;
    bool fixed;

    bool reserved1;
};


class wxAuiDockUIPart {
  public:
    enum {
      typeCaption,
      typeGripper,
      typeDock,
      typeDockSizer,
      typePane,
      typePaneSizer,
      typeBackground,
      typePaneBorder,
      typePaneButton
    };

    int type;
    int orientation;
    wxAuiDockInfo* dock;
    wxAuiPaneInfo* pane;
    wxAuiPaneButton* button;
    wxSizer* cont_sizer;
    wxSizerItem* sizer_item;
    wxRect rect;
};


class wxAuiPaneButton {
  public:
    int button_id;
};

BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE( wxEVT_AUI_PANE_BUTTON, 0 )
DECLARE_EXPORTED_EVENT_TYPE( wxEVT_AUI_PANE_CLOSE, 0 )
DECLARE_EXPORTED_EVENT_TYPE( wxEVT_AUI_PANE_MAXIMIZE, 0 )
DECLARE_EXPORTED_EVENT_TYPE( wxEVT_AUI_PANE_RESTORE, 0 )
DECLARE_EXPORTED_EVENT_TYPE( wxEVT_AUI_RENDER, 0 )
DECLARE_EXPORTED_EVENT_TYPE( wxEVT_AUI_FIND_MANAGER, 0 )
END_DECLARE_EVENT_TYPES()

typedef void ( wxEvtHandler::*wxAuiManagerEventFunction )( wxAuiManagerEvent& );

#define wxAuiManagerEventHandler(func) \
  (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiManagerEventFunction, &func)

#define EVT_AUI_PANE_BUTTON(func) \
  wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
#define EVT_AUI_PANE_CLOSE(func) \
  wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
#define EVT_AUI_PANE_MAXIMIZE(func) \
  wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
#define EVT_AUI_PANE_RESTORE(func) \
  wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
#define EVT_AUI_RENDER(func) \
  wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
#define EVT_AUI_FIND_MANAGER(func) \
  wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))


#endif

